package com.haiyou.common.constants.sdk;

import java.util.Map;
import java.util.Set;

import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

import com.google.common.collect.Maps;
import com.google.common.collect.Sets;

/**
 * 
 * 渠道参数
 * @author xingyuan 
 * @Date 2023年6月20日 上午9:00:24
 */
public class ChannelConstants {

	/**
	 * 本地haiyou
	 */
	public static final String haiyou = "hy";
	
	/**
	 * 微信sdk
	 */
	public static final String wechat = "wx";
	
	/**
	 * 抖音sdk
	 */
	public static final String douyin = "dy";
	/**
	 * 快手sdk
	 */
	public static final String kuaishou = "ks";
	/**
	 * 爱玩sdk
	 */
	public static final String aiwan = "aw";
	/**
	 * 爱玩国服sdk
	 */
	public static final String aiwan_cn = "aw_cn";
	/**
	 * 爱玩闲闲sdk
	 */
	public static final String aiwan_xx = "aw_xx";
	
	
	public static final Map<String, String> names = Maps.newHashMap();
	
	public static Set<String> keys = Sets.newHashSet(haiyou, aiwan, aiwan_cn, aiwan_xx, wechat, douyin, kuaishou);

	static {
		names.put(haiyou, "嗨哟游戏");
		names.put(aiwan, "爱玩");
		names.put(aiwan_cn, "爱玩国服");
		names.put(aiwan_xx, "爱玩闲闲");
		names.put(wechat, "微信");
		names.put(douyin, "抖音");
	}

	
	
	
	
	
	
	


	
	
	
	
	
	
	
	
	public static String name(String channel) {
		return names.getOrDefault(channel, channel);
	}
	
	
	/**
	 * 特殊处理渠道转换
	 * @param channel
	 * @return
	 */
	public static String convert(String channel) {
		
		if(!StringUtils.hasLength(channel)) {
			return haiyou;
		}
		
		return channel;
	}
	
	
	/**
	 * 手机短信登录,邮件密钥登录
	 */
	public static final int login_type_1 = 1;
	/**
	 * 账号密码登录
	 */
	public static final int login_type_2 = 2;
	/**
	 * 超登
	 */
	public static final int login_type_3 = 3;
	
	/**
	 * 邮箱验证码登录
	 */
	public static final int login_type_4 = 4;

	
	/**
	 * 渠道SDK 登录
	 */
	public static final int login_type_0 = 0;

	
	/**
	 * 判断参数是否正确
	 * @param channel
	 * @return
	 */
	public static boolean contain(String channel) {
		
		if(!StringUtils.hasLength(channel)) {
			return false;
		}
		
		if(ObjectUtils.isEmpty(keys)) {
			return false;
		}
		
		return keys.contains(channel);
	}
	
	
	
	
}
